Skip to content

feat: add admin range bonus management commands (removebonus + purgebonus)#2988

Merged
tastybento merged 3 commits into
developfrom
feature/admin-range-removebonus
Jun 2, 2026
Merged

feat: add admin range bonus management commands (removebonus + purgebonus)#2988
tastybento merged 3 commits into
developfrom
feature/admin-range-removebonus

Conversation

@tastybento

@tastybento tastybento commented Jun 1, 2026

Copy link
Copy Markdown
Member

What

Adds two admin commands for managing the bonus ranges stored on islands. Bonus ranges are static values added to (or subtracted from) an island's protection range, stored as BonusRangeRecords. Addons tag the ones they grant with their own addon name as the bonus uniqueId (e.g. the Upgrades addon uses "Upgrades"), so admins need a way to clear them — most importantly after the granting addon has been uninstalled.

Commands

/<admin> range removebonus <player> [id] (confirmable)

Operates on a single player's island.

  • No id → removes all bonus ranges from that island.
  • With id → removes only the bonus ranges for that unique id.
  • Tab completion offers the island's existing bonus-range ids.

/<admin> range purgebonus <id>… <id> confirm

Removes the bonus id from every island in the gamemode's world — the "addon was uninstalled, purge its bonus everywhere" workflow.

  • Async: the island scan runs off the main thread via IslandsManager#getIslandsASync(), so it won't freeze a large server. It reports the affected-island count, then you re-run with confirm to apply (reusing the scanned result — no second scan). An inPurge guard rejects overlapping runs.
  • Mutation + RANGE_CHANGE event firing happen back on the main thread, on the live cached island instances (resolved by id), with a per-island re-check in case state changed since the scan.
  • Tab completion lists the bonus ids on currently-loaded islands.

Both commands fire IslandEvent RANGE_CHANGE when an island's effective protection range actually changes. Persistence is via setChanged(), consistent with the existing range add/reset commands.

Changes

  • New AdminRangeRemoveBonusCommand and AdminRangePurgeBonusCommand, registered in AdminRangeCommand.
  • Locale keys commands.admin.range.{removebonus,purgebonus}.* added to en-US.yml and translated into all 22 other bundled locales.
  • Version bumped 3.17.03.17.1.
  • Test suites: AdminRangeRemoveBonusCommandTest (13) + AdminRangePurgeBonusCommandTest (12).

Testing

./gradlew build passes — full test suite + all 23 locale files parse. New suites: 25/25 green.

Non-English translations are best-effort and would benefit from native-speaker review; all preserve MiniMessage tags and placeholders exactly.

🤖 Generated with Claude Code

tastybento and others added 2 commits May 31, 2026 18:06
Adds AdminRangeRemoveBonusCommand under `/<admin> range removebonus
<player> [id]`, a confirmable command for clearing bonus ranges stored
on an island as BonusRangeRecords (typically granted by addons).

- With no id: removes every bonus range from the player's island.
- With an id: removes only the bonus ranges for that unique id.
- Tab completion offers the island's existing bonus-range ids so the
  admin does not have to guess them.
- Fires an IslandEvent RANGE_CHANGE if the effective protection range
  changed. The island is persisted via setChanged() (no explicit save).

Registers the subcommand in AdminRangeCommand, adds the
commands.admin.range.removebonus.* locale keys to en-US and translations
to all 22 other bundled locales, and bumps the build version to 3.17.1.
Adds AdminRangeRemoveBonusCommandTest (13 tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds AdminRangePurgeBonusCommand under `/<admin> range purgebonus <id>`,
a confirmable command that removes every bonus range carrying a given id
from ALL islands in the gamemode's world.

Addons tag the bonus ranges they grant with their own name (the bonus
uniqueId) - e.g. the Upgrades addon stores them under "Upgrades". When
such an addon is uninstalled its bonus ranges linger on every island it
touched; this command purges them in one pass.

- Iterates the island cache so the live, canonical island instances are
  mutated (clearBonusRange -> setChanged persists each changed island).
- Fires an IslandEvent RANGE_CHANGE per island whose effective protection
  range changed.
- Warns how many islands will be affected before confirmation.
- Tab completion lists the bonus ids present on loaded islands so the
  admin doesn't have to guess them.

Registers the subcommand, adds commands.admin.range.purgebonus.* locale
keys to en-US and translations to all 22 other bundled locales, and adds
AdminRangePurgeBonusCommandTest (7 tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tastybento tastybento changed the title feat: add admin range removebonus command feat: add admin range bonus management commands (removebonus + purgebonus) Jun 1, 2026
Reworks AdminRangePurgeBonusCommand so the potentially heavy island scan
no longer blocks the main thread on large servers, following the
established purge-command pattern.

- The scan that finds islands carrying the bonus id now runs off-thread
  via IslandsManager#getIslandsASync(); results are marshalled back to
  the main thread to prompt and to apply.
- Confirmation is now explicit: `/<admin> range purgebonus <id>` scans
  and reports the count, then `/<admin> range purgebonus <id> confirm`
  applies it (reusing the scanned result - no second scan). An inPurge
  guard rejects overlapping runs.
- The mutation and IslandEvent RANGE_CHANGE firing still happen on the
  main thread, on the live cached island instances (resolved by id),
  with per-island re-check in case state changed since the scan.

Adds locale keys commands.admin.range.purgebonus.{confirm,in-progress,
failed} to en-US and all 22 other locales. Rewrites the test suite (12
tests) to cover the sync seams: findIslandIds, applyPurge, the confirm
dispatch, canExecute guards and tab completion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@tastybento tastybento merged commit 43f8bb3 into develop Jun 2, 2026
3 checks passed
@tastybento tastybento deleted the feature/admin-range-removebonus branch June 2, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant